//
//  BookChapterInfo.m
//  QiYReader
//
//  Created by 奇阅科技 on 14/11/28.
//  Copyright (c) 2014年 奇阅科技. All rights reserved.
//

#import "BookChapterInfo.h"

@implementation BookChapterInfo
+(BookChapterInfo *)getFromDict:(NSDictionary *)dict{
    BookChapterInfo *comment = [BookChapterInfo new];
    comment.chapterId = [dict objectForKey:@"id"];
    comment.chapterName = [[dict objectForKey:@"subhead"]stringByReplacingOccurrencesOfString:@"&#160;" withString:@" "];
    comment.is_vip = [dict objectForKey:@"is_vip"];
    comment.word_count = [dict objectForKey:@"word_count"];
    return comment;
    
}
- (id)initWithCoder:(NSCoder *)decoder {
    self = [super init];
    if (self != nil) {
        self.chapterId = [decoder decodeObjectForKey:@"chapterId"];
        self.chapterName = [decoder decodeObjectForKey:@"subhead"];
        self.is_vip = [decoder decodeObjectForKey:@"is_vip"];
        self.word_count= [decoder decodeObjectForKey:@"word_count"];
    }
    return self;
}

- (void)encodeWithCoder:(NSCoder *)encoder {
    [encoder encodeObject:self.chapterId forKey:@"chapterId"];
    [encoder encodeObject:self.chapterName forKey:@"subhead"];
    [encoder encodeObject:self.is_vip forKey:@"is_vip"];
    [encoder encodeObject:self.word_count forKey:@"word_count"];
}

@end
